package com.qf.team2.netdisc.common.pojo.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.sql.Timestamp;
import java.util.Objects;

/**
 * 分享链接实体类
 *
 * @author Simon_Wong
 * @date 2021/05/20
 * @since 2021/5/20 9:06
 */
@ApiModel("分享链接实体")
public class Link {

    @ApiModelProperty("链接id")
    private Integer id;

    @ApiModelProperty("链接地址")
    private String url;

    @ApiModelProperty("分享的文件对应的用户id")
    private Integer userId;

    @ApiModelProperty("分享的文件的id")
    private Integer documentId;

    @ApiModelProperty("md5")
    private String md5;

    @ApiModelProperty(value = "验证码", notes = "当文件不是私密分享时，验证码为null", allowEmptyValue = true)
    private String verifyCode;

    @ApiModelProperty("是否私密分享")
    private Boolean isPrivate;

    @ApiModelProperty("分享期限")
    private Long deadline;

    private Timestamp createTime;

    public Link() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getDocumentId() {
        return documentId;
    }

    public void setDocumentId(Integer documentId) {
        this.documentId = documentId;
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public String getVerifyCode() {
        return verifyCode;
    }

    public void setVerifyCode(String verifyCode) {
        this.verifyCode = verifyCode;
    }

    public Boolean getPrivate() {
        return isPrivate;
    }

    public void setPrivate(Boolean aPrivate) {
        isPrivate = aPrivate;
    }

    public Long getDeadline() {
        return deadline;
    }

    public void setDeadline(Long deadline) {
        this.deadline = deadline;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Link link = (Link) o;
        return Objects.equals(id, link.id) && Objects.equals(url, link.url) && Objects
                .equals(userId, link.userId) && Objects.equals(documentId, link.documentId) && Objects
                .equals(md5, link.md5) && Objects.equals(verifyCode, link.verifyCode) && Objects
                .equals(isPrivate, link.isPrivate) && Objects.equals(deadline, link.deadline) && Objects
                .equals(createTime, link.createTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, url, userId, documentId, md5, verifyCode, isPrivate, deadline, createTime);
    }

}
